<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	response.setHeader("X-Frame-Options","SAMEORIGIN");
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<jsp:include page="../../public/public.jsp"/>
<script type="text/javascript">
	$(function(){
		init();
	})
	function refresh(){
		$('#datagrid').datagrid("reload");
	}
	function init() {
		$('#datagrid').datagrid({
			url : "<%=basePath%>ipLog/queryLog", //获取数据地址
			fit : true, //适应大小
			fitColumns : false, //自动扩大或缩小列的尺寸以适应网格的宽度并且防止水平滚动
			nowrap : false, //是否关闭自动换行(true关闭，false开启)
			border : false, //边框
			toolbar:menu_tb,//加载按钮功能
			remoteSort : false,
			singleSelect : true,
			rownumbers : true,
			columns : [ [ {
				title : "",
				field : "type",
				align : 'center',
				width :150 ,
				formatter : function(value, row, index) {
				
					var str = "";
					if(index==0){
						str="总流量";
					}
					if(index==1){
						str="当日流量";
					}
					if(index==2){
						str="当月流量";
					}
					if(index==3){
						str="上月流量";
					}
					if(index==4){
						str="当年流量";
					}
					return str;
				}
			}, {
				title : "网站访问量",
				field : "ipCount",
				align : 'center',
				width : 160
				
			}] ]
		});
	}
</script>
</head>
<body class="easyui-layout">
	<div style="height: 100%; width: 100%">
		<div id="menu_tb">
		     <table>       
		     	<tr>
		            <td>
		                <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-mini-refresh" plain="true" onclick="refresh()">刷新列表</a>
		            </td>
		             <td style="width: 170px;">
		                
		             </td>
		             <td>
		               <span style="color: blue;">开始统计时间为：2013年5月21日</span>
		            </td>
		        </tr>
		    </table>
		</div>
	<table id="datagrid"></table>
</div>
<script type="text/javascript">

/*对创建时间format  */	
function formatDatebox(value) {  
    if (value == null || value == '') {  
        return '';  
    }  
    var dt;  
    if (value instanceof Date) {  
        dt = value;  
    } else {  
        dt = new Date(value);  
    }  
  
    return dt.format("yyyy-MM-dd"); //扩展的Date的format方法(上述插件实现)  
}
	
	Date.prototype.format = function (format) {  
	    var o = {  
	        "M+": this.getMonth() + 1, // month  
	        "d+": this.getDate(), // day  
	        "h+": this.getHours(), // hour  
	        "m+": this.getMinutes(), // minute  
	        "s+": this.getSeconds(), // second  
	        "q+": Math.floor((this.getMonth() + 3) / 3), // quarter  
	        "S": this.getMilliseconds()  
	        // millisecond  
	    }  
	    if (/(y+)/.test(format))  
	        format = format.replace(RegExp.$1, (this.getFullYear() + "")  
	            .substr(4 - RegExp.$1.length));  
	    for (var k in o)  
	        if (new RegExp("(" + k + ")").test(format))  
	            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));  
	    return format;  
} 
</script>
</body>
</html>